package bridges;

import java.io.PrintWriter;

public class CommunicationBridge {
	
	private PrintWriter out;
	private long javaThreadId;
	private String userName;
	private int userSubForum;
	private int threadForum;
	
	
	public CommunicationBridge(PrintWriter out, long threadId) {
		this.out = out;
		this.javaThreadId = threadId;
		this.userName = null;
		this.userSubForum =-1;
		this.threadForum =-1;
	}
	/**
	 * @return the userSubForum
	 */
	public int getUserSubForum() {
		return userSubForum;
	}
	/**
	 * @param userSubForum the userSubForum to set
	 */
	public void setUserSubForum(int userSubForum) {
		this.userSubForum = userSubForum;
	}
	/**
	 * @return the userName
	 */
	public String getUserName() {
		return userName;
	}
	/**
	 * @param userName the userName to set
	 */
	public void setUserName(String userName) {
		if (userName != null)
		{
			this.userName = userName.toLowerCase();
		}
	}
	/**
	 * @return the out
	 */
	public PrintWriter getOut() {
		return out;
	}
	/**
	 * @return the threadId
	 */
	public long getJavaThreadId() {
		return javaThreadId;
	}
	public void send(MsgAndId msgAndId) {
		out.println(msgAndId.getMsg());
	}
	
	
	public void setThreadForum(int threadForum) {
		this.threadForum = threadForum;
	}
	public int getThreadForum() {
		return threadForum;
	}
	
	

}
